<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div id="main_region_list" class="easyui-layout" fit="true">
    <div region="center" style="padding:0px;border:0px">
        <t:datagrid name="regionList" checkbox="false" pagination="true" treegrid="true" treeField="name"
                    fitColumns="true" title="区域" actionUrl="regionController.do?datagrid" idField="regionid" fit="true"
                    queryMode="group">
            <t:dgCol title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="创建人名称" field="createName" hidden="true" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="创建人登录名称" field="createBy" hidden="true" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="创建日期" field="createDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single"
                     width="120"></t:dgCol>
            <t:dgCol title="更新人名称" field="updateName" hidden="true" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="更新人登录名称" field="updateBy" hidden="true" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="更新日期" field="updateDate" formatter="yyyy-MM-dd" hidden="true" queryMode="single"
                     width="120"></t:dgCol>
            <t:dgCol title="名称" field="name" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="编码" field="code" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="rf编码" field="rfCode" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="父级菜单" field="fatherId" hidden="true" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="操作" field="opt" width="100"></t:dgCol>
            <t:dgDelOpt title="删除" url="regionController.do?doDel&id={id}" urlclass="ace_button" urlfont="fa-trash-o"/>
            <t:dgFunOpt funname="queryEquipment(id)" title="查看设备" urlclass="ace_button"></t:dgFunOpt>
            <t:dgToolBar title="录入" icon="icon-add" url="regionController.do?goAdd" funname="add"></t:dgToolBar>
            <t:dgToolBar title="编辑" icon="icon-edit" url="regionController.do?goUpdate" funname="update"></t:dgToolBar>
            <t:dgToolBar title="批量删除" icon="icon-remove" url="regionController.do?doBatchDel"
                         funname="deleteALLSelect"></t:dgToolBar>
            <t:dgToolBar title="查看" icon="icon-search" url="regionController.do?goUpdate"
                         funname="detail"></t:dgToolBar>
            <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
            <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
            <t:dgToolBar title="模板下载" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>
        </t:datagrid>
    </div>
</div>
<div data-options="region:'east',
	title:'设备列表',
	collapsed:true,
	split:true,
	border:false,
	onExpand : function(){
		li_east = 1;
	},
	onCollapse : function() {
	    li_east = 0;
	}"
     style="width: 400px; overflow: hidden;" id="eastPanel">
    <div class="easyui-panel" style="padding:0px;border:0px" fit="true" border="false" id="userListpanel"></div>
</div>
<script src="webpage/com/jeecg/region/regionList.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#regionList").treegrid({
            onExpand: function (row) {
                var children = $("#regionList").treegrid('getChildren', row.id);
                if (children.length <= 0) {
                    row.leaf = true;
                    $("#regionList").treegrid('refresh', row.id);
                }
            }
        });
    });


    //导入
    function ImportXls() {
        openuploadwin('Excel导入', 'regionController.do?upload', "regionList");
    }

    //导出
    function ExportXls() {
        JeecgExcelExport("regionController.do?exportXls", "regionList");
    }

    //模板下载
    function ExportXlsByT() {
        JeecgExcelExport("regionController.do?exportXlsByT", "regionList");
    }

    /**
     * 获取表格对象
     * @return 表格对象
     */
    function getDataGrid() {
        var datagrid = $('#' + gridname);
        return datagrid;
    }

    function queryEquipment(regionid) {
        var title = '设备列表';
        if (li_east == 0 || $('#main_region_list').layout('panel', 'east').panel('options').title != title) {
            $('#main_region_list').layout('expand', 'east');
        }
        <%--$('#eastPanel').panel('setTitle','<t:mutiLang langKey="member.list"/>');--%>
        $('#main_region_list').layout('panel', 'east').panel('setTitle', title);
        $('#main_region_list').layout('panel', 'east').panel('resize', {width: 500});
        $('#userListpanel').panel("refresh", "regionController.do?equipmentList&regionid=" + regionid);
    }
</script>